package ArithmeticObjects;

/**
 * Representing a Field, indicating relevant arithmetic objects' order 
 * @author Idan
 */
public class Field {
	protected LargeNumberObject order;
	
	/**
	 * creates a Field from an LargeNumberObject representing its order
	 * @param order a LargeNumberObject representing the Field's order
	 * @throws Exception in case the order was not given as a LargeNumberObject
	 */
	public Field(Element order) throws Exception{
		int certainty = (int)Math.pow(10,6);
		if (!order.getValue().isProbablePrime(certainty))
			throw new Exception("Field order must be prime!");
		this.order = new LargeNumberObject(order.getValue());
	}
	
	/**
	 * @return the Field's order
	 */
	public Element getOrder() {
		return order;
	}
}
